﻿using System;
using System.Collections.Generic;

namespace DataAccessLayer
{
    /// <summary>
    /// Class tat defines user story
    /// </summary>
    public class UserStory : WorkItem
    {
        public List<Task> Tasks { get; set; }
        public DateTime TimePosted { get; set; }

        /// <summary>
        /// Constructor for user story
        /// </summary>
        /// <param name="name">Name of user story</param>
        /// <param name="description">Description for user story</param>
        /// <param name="attach">Array of attached files for user story</param>
        /// <param name="assign">Leading user of user story</param>
        /// <param name="status">Status uf user story (New/InProgress/Done)</param>
        /// <param name="subTasks">List of subtasks of user story</param>
        public UserStory(string name, string description, object[] attach,
            User assign, Statuses status, IEnumerable<Task> subTasks)
        {
            Name = name;
            Description = description;
            Attachments = attach;
            AssignedTo = assign;
            Status = status;
            Tasks = new List<Task>();
            foreach (var task in subTasks)
                if (task != null) Tasks.Add(task);
            TimePosted = DateTime.Now;
        }
    }
}

